package com.doeis.uwork.entity.mongo;

import com.doeis.uwork.common.Constant;
import com.doeis.uwork.entity.PictureInfo;
import com.mongodb.BasicDBObject;
import com.voland.core.db.DaoException;
import com.voland.core.db.MongoDao;

public class PictureInfoMongo extends MongoDao {
	
	public PictureInfo findPictureInfo(String url) throws DaoException{
		try{
			BasicDBObject query = new BasicDBObject();
			query.append("url", url);
			BasicDBObject sort = new BasicDBObject("created_at", Constant.ORDER_DESCENDING);			
			return super.read(Constant.DATABASE_MONGO_DOEIS, PictureInfo.class, query, null, sort);
		}catch(Exception e){
			throw new DaoException(e);
		}
	}
}
